//常量
var thispage=1;
var pages
//运行

readdate('notype',"seq",'time1','time2','uname',thispage);
//ajks

function readdate(type,seq,time1,time2,uname,page) {
	$.ajax({
		url: "Arcale",
		type: "post",
		dataType: "JSON",
		data: {
            one:type,
            two:seq,
            three:time1,
            four:time2,
            five:uname,
            page:page
		},
		success: function(data) { 
            console.log(data);
            show(data);  	
		},
		error: function(err) {
			console.log(err)
		},
	});
}
function show(data){
    document.getElementById("tbody").innerHTML='';
    pages=data.pages;
    for (i = 0; i < data.list.length; i++) {
        createtable(data.list[i].aRCALE_ID,data.list[i].uSER_NAME,data.list[i].aRCLAE_NAME,data.list[i].aRCALE_TYPE,data.list[i].pIC,data.list[i].aRCALE_SCORE,data.list[i].tIME1,data.list[i].sTATE_NAME,)
        
    }
}



//创建表格
function createtable(seq,name,arcale_type,type,img,score,date,stati){
    var tbody =document.getElementById("tbody");
    var tr = document.createElement("tr");
    var td =document.createElement("td");
    td.id ="seq"+seq;
    td.innerHTML =seq;
    var td1 =document.createElement("td");
    td1.innerHTML=name;
    var td2 =document.createElement("td");
    td2.innerHTML=arcale_type;
    var td3 =document.createElement("td");
    td3.innerHTML=type;
    var td4 =document.createElement("td");
    td4.innerHTML=img;

    var td5 =document.createElement("td");
    td5.innerHTML=score;
    var td6 =document.createElement("td");
    td6.innerHTML=date;

    var td7 =document.createElement("td");
    td7.innerHTML=stati;

    var td8 =document.createElement("td");

    var check=document.createElement('input'); 
    check.type='button';
    check.value="通过";
    check.onclick =function(){
        var seq=document.getElementById( td.id).innerHTML;
        readdate('upstate',seq,'time1','time2','uname',thispage);
    }


    tr.appendChild(td);
    tr.appendChild(td1);
    tr.appendChild(td2);
    tr.appendChild(td3);
    tr.appendChild(td4);
    tr.appendChild(td5);
    tr.appendChild(td6);
    tr.appendChild(td7);
    tr.appendChild(td8);
    td8.appendChild(check);
    tbody.appendChild(tr);
}

function select(){
    var sdate=document.getElementById("starttime").value;
    var edate=document.getElementById("endtime").value;
    var tname =document.getElementById("tname").value;

    readdate('select',sdate,edate,tname,'uname',thispage);
}

function Arcalefron(){
    if(thispage-1>0){
        thispage=(thispage-1);
        readdate('notype',"seq",'time1','time2','uname',thispage);
    }else {
        alert("没有上一页");
    }
}
function Arcalefronnext() {
    if (thispage < pages) {
        thispage = (thispage + 1);
        readdate('notype',"seq",'time1','time2','uname',thispage);
    } else {
        alert("没有下一页");
    }
}